Skip to content

Auto parse number fix on unsafe numbers#8

Merged
vethman merged 2 commits into
mainfrom
autoParseNumber-fix-on-unsafe-numbers
Mar 26, 2026
Merged

Auto parse number fix on unsafe numbers#8
vethman merged 2 commits into
mainfrom
autoParseNumber-fix-on-unsafe-numbers

Conversation

@vethman

@vethman vethman commented Mar 24, 2026

Copy link
Copy Markdown
Member

This pull request introduces a new option, preserveUnsafeIntegersAsString, to the CSV parsing library. When enabled alongside autoParseNumbers, this option ensures that integer strings outside JavaScript's safe integer range are preserved as strings, preventing precision loss. The default behavior remains unchanged, and the new option is opt-in. The update includes changes to the core parsing logic, documentation, and adds comprehensive tests to cover the new functionality.

Feature: Preserve Unsafe Integers as Strings

  • Added a new preserveUnsafeIntegersAsString option to CsvParserOptions and updated the parsing logic in both CsvStreamParser and NestedJsonConverter to use this option when parsing numbers, preserving unsafe integers as strings to avoid precision loss. [1] [2] [3] [4] [5] [6] [7] [8]

Documentation Updates

  • Updated README.md to document the new preserveUnsafeIntegersAsString option, including usage examples and notes about JavaScript number precision. [1] [2]

Testing

  • Added and updated tests in csv-stream-parser.test.ts and edge-cases.test.ts to verify correct behavior when the option is enabled, default behavior remains unchanged, and safe integers are still parsed as numbers. [1] [2]

Release Notes

  • Added a changeset describing the new feature and its purpose for future releases.

@vethman vethman merged commit d5521f8 into main Mar 26, 2026
4 checks passed
@vethman vethman deleted the autoParseNumber-fix-on-unsafe-numbers branch March 26, 2026 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants